package com.example.qianjun.gobang01.robot_player;

import android.graphics.Point;

import com.example.qianjun.gobang01.abs.AIPlayer;
import com.example.qianjun.gobang01.bean.Constant;
import com.example.qianjun.gobang01.util.ReferenceInit;

/**
 * Created by qianjun on 2016/5/2.
 */
public class NovicePlayer extends AIPlayer {
    @Override
    public Point findBestPoint(int pieceType) {

        int table_x = ReferenceInit.getGobangCheckboard().getTable_x();
        int table_y = ReferenceInit.getGobangCheckboard().getTable_y();
        int x=(int)(Math.random()*table_x-1);
        int y=(int)(Math.random()*table_y-1);
        int[][] table= ReferenceInit.getGobangCheckboard().getTable();
        while(table[x][y] != Constant.NO_PIECES){
            x=(int)(Math.random()*table_x-1);
            y=(int)(Math.random()*table_y-1);
        }
        return new Point(x,y);
    }
}
